package cn.tedu._04interceptor.config;

import cn.tedu._04interceptor.interceptors.Myinterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration     //标志为配置类
/**
 * 配置拦截器
 */
public class InterceptorConfig implements WebMvcConfigurer {
    /*
    拦截用户模块的所有请求
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new Myinterceptor())
                .addPathPatterns("/v1/user/**");
    }
}
